package riven.club.demo.repository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import riven.club.common.repository.AbstractRepository;
import riven.club.demo.entity.StudentP;

/**
 * @author 陈浩
 * @date 2021-10-13 17:40
 */
public interface StudentRepository extends AbstractRepository<StudentP, String> {

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    @Query(value = "update StudentP p set p.username =?1 where p.id =?2")
    void updateName(String userName, String id);

//    @Override
//    @Query(value = "select p from StudentP p where p.id =?1")
//    StudentP getById(String id);
}
